rm(list=ls())
setwd("F:/n2mosurgery")

library(survival)
library(survminer)
library(DynNom)
library(rsconnect)

data<-read.csv("1.csv",header=T,sep=",")
seer=data

seer$Age<-factor(seer$Age,labels = c("<60","60-69","70-79",">=80"))
seer$Race<-factor(seer$Race,labels=c("Black","White","Other","Unknow"))
seer$Gender<-factor(seer$Gender,labels=c("Female","Male"))
seer$Location<-factor(seer$Location,labels=c("Right upper lobe","Right middle lobe","Right lower lobe","Left upper lobe","Left lower lobe","others"))
seer$Grade<-factor(seer$Grade,labels=c("I","II","III","IV","Unknow"))
seer$T<-factor(seer$T,labels=c("T1","T2","T3","T4"))
# seer$N<-factor(seer$N,labels=c("N0","N1","N2","N3"))
seer$Surgery<-factor(seer$Surgery,labels=c("No","Yes"))
seer$SRLNR<-factor(seer$SRLNR,labels =c("None","<4",">=4","Others"))
seer$Radiation<-factor(seer$Radiation,labels=c("No or unknown","Yes"))
seer$Chemotherapy<-factor(seer$Chemotherapy,labels=c("No or unknown","Yes"))
set.seed(123)
tr<-sample(nrow(seer),0.7*nrow(seer))
train<-seer[tr,]
test<-seer[-tr,]
seer$group<-0
seer$group[-tr]<-1
seer$group<-factor(seer$group,labels=c("train","test"))
cox<-coxph(Surv(Survival,Status)~Age+Gender+Location+T+Surgery+SRLNR+Radiation+Chemotherapy,data=train)
DNbuilder(cox,covariate="numeric")
rsconnect::setAccountInfo(name='',
                          token='',
                          secret='')
accounts(server = NULL)
# removeAccount(name="",server=NULL)
rsconnect::deployApp("F:/n2mosurgery/DynNomapp")
